package demo12;

import java.util.Scanner;
import java.util.Stack;

public class test117 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s1 = scanner.nextLine();
        char[] arr = s1.toCharArray();
        Stack<Character> s = new Stack<>();
        for(int i = 0; i < arr.length; i++) {
            if(s.empty()) {
                s.push(arr[i]);
            }else {
                if(s.peek() != arr[i]) {
                    s.push(arr[i]);
                }else {
                    s.pop();
                }
            }
        }
        if(s.empty()) {
            System.out.println(0);
        }else {
            StringBuilder ret = new StringBuilder();
            while(!s.empty()) {
                ret.append(s.pop());
            }
            System.out.println(ret.reverse());
        }
    }
}
